# Using for loop and negative idx

s = [9, 7, 8, 3, 2, 1, 55, 6]

max_element = s[0]
min_element = s[0]
list_sum = 0
list_length = 0

idx = -1

while idx != -(len(s)+1):
    if s[idx] > max_element: max_element = s[idx]
    if s[idx] < min_element: min_element = s[idx]
    list_sum += s[idx]
    list_length += 1
    idx -= 1

print("There are {} elements in the list:".format(list_length))

print("The max element is {}; the min element is {}.".format(max_element, min_element))

print("Their sum is {}, and the average is {}.".format(list_sum, list_sum/list_length))
